﻿namespace Digitalmes.Domain.Mes;

/// <summary>
/// 物料产品信息。
/// </summary>
[SugarTable("md_item", "物料产品信息表")]
public class MdItem : EntityBase, IDeletedFilter
{
    /// <summary>
    /// 物料编号
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "物料编号", Length = 64)]
    public string? ItemCode { get; init; }

    /// <summary>
    /// 物料名称
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "物料名称", Length = 64)]
    public string? ItemName { get; set; }

    /// <summary>
    /// 物料型号
    /// </summary>
    [SugarColumn(ColumnDescription = "物料型号", Length = 128)]
    public string? Model { get; set; }

    /// <summary>
    /// 物料规格
    /// </summary>
    [SugarColumn(ColumnDescription = "物料规格", Length = 128)]
    public string? Spec { get; set; }

    /// <summary>
    /// 计量单位
    /// </summary>
    [SugarColumn(ColumnDescription = "计量单位", Length = 16)]
    public string? Unit { get; set; }

    /// <summary>
    /// 物料属性（自制件/外购件/外协件）
    /// </summary>
    [SugarColumn(ColumnDescription = "物料属性（自制件/外购件/外协件）")]
    public MaterialAttrEnum Attr { get; set; }

    /// <summary>
    /// 物料分类（成品/半产品/原材料）
    /// </summary>
    [SugarColumn(ColumnDescription = "物料分类（成品/半产品/原材料）")]
    public MaterialClassifyEnum Classify { get; set; }

    /// <summary>
    /// 条码校验规则集合
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "保质期（天）", IsJson = true, Length = 512)]
    public List<string>? Rules { get; set; }

    /// <summary>
    /// 保质期（天）
    /// </summary>
    [SugarColumn(ColumnDescription = "保质期（天）")]
    public int Expiration { get; set; }

    /// <summary>
    /// 物料供应商
    /// </summary>
    [SugarColumn(ColumnDescription = "物料供应商", Length = 64)]
    public string? Supplier { get; set; }

    /// <summary>
    /// 是否删除
    /// </summary>
    [SugarColumn(ColumnDescription = "是否删除")]
    public bool IsDel { get; set; }
}
